package com.next

class EmployeePosition
{
    Position position
    Boolean isPrimary = true
    Boolean active = true

    Date startTime
    Date endTime

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static belongsTo = [employee: Employee]
    static constraints = {
        endTime nullable: true, blank: true
    }

    String toString()
    {
        "${employee} - ${position}"
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }
}
